import { crtChannel } from "./crtChannel";
import { Tip } from "../scripts/TipManager";
import { crtChannelHw } from "./crtChannelHw";

/**
 * 
 
 */
export class prv {

    /** 是否已经初始化 */
    static isInit: boolean = false;


    static init() {
        this.isInit = true;
        console.error('=====>初始化prv', crtChannel.channel);
        //@ts-ignore
        window.__prv = this;
        crtChannel.init();
        //@ts-ignore
        window.countWin = 0;
    }


    public static toast(txt: string, startY: number = 0) {
        crtChannel.toast(txt, startY);
    }

    static showBoxSurprise() {
        if (crtChannel.channel != 'ks1' && crtChannel.channel != 'ks3') {
            crtChannel.getChannel().showBoxSurprise();
        }
    }
    static showLoginSuccessTip() {

        Tip.show("登录成功");

    }

    static showLoginUI() {
        (crtChannel.getChannel() as crtChannelHw).showLoginUI();
    }
    static qgLogin(succes, end) {
        crtChannel.getChannel().qgLogin(succes, end)
    }
    /**入口有奖弹窗 */
    static showSliderBarView() {
        crtChannel.getChannel().showSliderBarView();
    }
    /**九宫格弹窗 */
    static showRewardFrame() {
        crtChannel.getChannel().showRewardFrame();
    }

    /**弹出登录奖励 */
    static loginReward() {
        crtChannel.getChannel().loginReward();
    }

    /**弹出设为桌面奖励 */
    static setDeskView() {
        crtChannel.getChannel().setDeskView();
    }

    /**弹出设为常用弹窗 */
    static showCommonUseView() {
        crtChannel.getChannel().showCommonUseView();
    }


    static getChannel() {
        return crtChannel.channel;
    }

    static getRuanZhu() {
        return crtChannel.getChannel().ruanzhu;
    }

    static doAction(actid: number, para: any) {
        crtChannel.getChannel().doAction(actid, para);
    }

    static showVideo(succ) {
        crtChannel.getChannel().showVideo(succ);
    }

    static showInter(isBanner: boolean = false, style?: any) {
        crtChannel.getChannel().showInter(false, style);
    }

    static closeInter() {
        crtChannel.getChannel().closeInter();
    }

    static showBanner() {
        crtChannel.getChannel().showBanner();
    }

    static showHt() {
        crtChannel.getChannel().showHt();
    }

    static getCtrl(key: string): number {
        return crtChannel.getChannel().getCtrl(key);;
    }
    /** getSystemInfoSync */
    static getSysInfo(): any {
        return crtChannel.getChannel().getSysInfo();
    }

    static closeKuangDian() {
    }

    /**添加桌面快捷方式 */
    static addShortCut(paras: { sucCall: any, failCall: any }) {
        crtChannel.getChannel().addShortCut(paras);
    }

    /**添加为常用 */
    static addCommonUse(paras: { sucCall: any, failCall: any }) {
        crtChannel.getChannel().addCommonUse(paras);
    }

}
